package cy.pj.common.util;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import javax.servlet.http.HttpServletRequest;

public class PageUtils {
    public static <T>Page<T> startPage(){
        HttpServletRequest request = ServletUtil.getRequest();
        String pageSizeStr = request.getParameter("pageSize");
        String pageCurrentStr = request.getParameter("pageCurrent");
        System.out.println("pageSize="+pageSizeStr);
        System.out.println("pageCurrent="+pageCurrentStr);
        Integer pageCurrent =
                StringUtil.isEmpty(pageCurrentStr)?1:Integer.parseInt(pageCurrentStr);
        Integer pageSize =
                StringUtil.isEmpty(pageSizeStr)?10:Integer.parseInt(pageSizeStr);
        return PageHelper.startPage(pageCurrent,pageSize);
    }
}
